package com.sparrow.common.ai.fsm;

public class RunState implements State<TestStateMachinePlayer> {
    @Override
    public void enter(StateMachineContext<TestStateMachinePlayer> ctx) {
        System.out.println(ctx.getOwner().getName() + " 开始移动");
        ctx.put("moveSpeed", 5);
    }

    @Override
    public void update(StateMachineContext<TestStateMachinePlayer> ctx) {
        Integer speed = ctx.get("moveSpeed", Integer.class);
        if (speed != null) {
            System.out.println("当前移动速度: " + speed);
        }
    }

    @Override
    public void exit(StateMachineContext<TestStateMachinePlayer> ctx) {
        System.out.println(ctx.getOwner().getName() + " 停止移动");
    }
}
